<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class CarModel extends Model
{

    /**
     * 关联到模型的数据表
     *
     * @var string
     */
    protected $table = 'car_model';


    public static function edit( $id, $data){
        $now = Date('Y-m-d H:i:s');
        $sql = "update car_model set `name`=?, updated_at='$now', factory_id=? where id='".$id."'";
        $data = DB::update( $sql,[ $data['name'], $data['factory_id'] ] );
        return $data;

    }

}